package com.woniuxy.userapp.common.util;


import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;

import java.util.List;

public class BindingResultUtil {


    public static void parameterCheck(BindingResult bindingResult){
        if(bindingResult.hasErrors()){
            List<ObjectError> allErrors = bindingResult.getAllErrors();
            for(ObjectError allError : allErrors){
                System.out.println(allError.getDefaultMessage());
                throw new RuntimeException(allError.getDefaultMessage());
            }
        }
    }
}
